<html>
<head><meta charset="utf-8"><title>Endgame for Polonius? · t-compiler/wg-polonius · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/index.html">t-compiler/wg-polonius</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html">Endgame for Polonius?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="221365150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221365150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221365150">(Jan 01 2021 at 19:30)</a>:</h4>
<p>Is the general consensus that the culmination of the Polonius effort will include an embedded datalog solver in <code>rustc</code>? Or is datalog just meant for prototyping the "sets of loans" approach to borrow-checking? My assumption is the former, since otherwise I don't see a reason to have datalog versions of liveness/initialization: those problems are already well understood. Having a datalog solver would also make it easier to implement other analyses (pointer analysis for mir-opt comes to mind). On the other hand, it will be very difficult to make the datalog version execute as fast as a hand-optimized version, so there will be pressure to switch if/when the final semantics are decided on.</p>
<p>This question is important for me, since it will determine how much effort should be spent trying to speed up the datafrog and/or the Polonius rules.</p>



<a name="221370706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221370706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221370706">(Jan 01 2021 at 21:51)</a>:</h4>
<p>this is a question that is hard for me to answer unfortunately: I'll try to summarize, and be extra clear when things are my opinion, and when there's consensus</p>



<a name="221370835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221370835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221370835">(Jan 01 2021 at 21:54)</a>:</h4>
<p>I think the endgame plan is not yet set in stone. I think the consensus would be that if we could get away with it, we would.</p>



<a name="221370913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221370913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221370913">(Jan 01 2021 at 21:56)</a>:</h4>
<p>That is, we do have the prototyping use-case you mention, absolutely. And if that prototype was acceptable to use in production, I can't think of why we wouldn't use it.</p>



<a name="221371080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371080">(Jan 01 2021 at 22:00)</a>:</h4>
<p>There's also value in having "the whole of the borrow checker" in a single, easy to understand place (that's a bit handwavy as so much of that behaviour also depends on rust-to-MIR and MIR-to-facts lowering, NLL-constraints-to-facts lowering, etc), and in a library that others could use, say rust-analyzer in an ideal world</p>



<a name="221371159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371159">(Jan 01 2021 at 22:02)</a>:</h4>
<p>so those are why we currently have re-done the parts you mention, with the results you mention, it is indeed hard to match the already existing versions.</p>



<a name="221371165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371165">(Jan 01 2021 at 22:02)</a>:</h4>
<p>whether that's enough of a justification we're not sure</p>



<a name="221371172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371172">(Jan 01 2021 at 22:03)</a>:</h4>
<p>at least those are the goals</p>



<a name="221371268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371268">(Jan 01 2021 at 22:05)</a>:</h4>
<p>my own thoughts are: as things stand today, I'm not sure we can get away with it. I don't know what your dataflow expertise tells you about this question ?</p>



<a name="221371328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371328">(Jan 01 2021 at 22:06)</a>:</h4>
<p>we also lack information to have an informed opinion: we lack both data and benchmarks.</p>



<a name="221371395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371395">(Jan 01 2021 at 22:08)</a>:</h4>
<p>we also don't know our "budget": what is considered an acceptable cost for the increased precision we'd gain</p>



<a name="221371693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371693">(Jan 01 2021 at 22:16)</a>:</h4>
<p>especially thinking this cost is hard to quantify in practice: we have access to a lot of code and benchmarks that do compile. The vast majority of that will pass the location insensitive analysis: modulo some subtlety about fact generation, more dialogue between rustc and polonius to possibly avoid some work, all those will be super fast. Whenever there's a "potential error" (either of 2 kinds) we'll also be able to heavily filter the data that does not contribute to these 2 errors, making even the location-sensitive analyses "not that slow"</p>



<a name="221371712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371712">(Jan 01 2021 at 22:17)</a>:</h4>
<p>This is also why we have been focusing on correctness and completeness, before focusing on performance</p>



<a name="221371852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371852">(Jan 01 2021 at 22:21)</a>:</h4>
<p>but they are ultimately related in the "if we can't pull it off, what do we do" sense, and this is where I've been focusing most of my efforts (trying to come up with different ways of making that work and failing at that a whole lot) rather than move errors or liveness.</p>



<a name="221371908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371908">(Jan 01 2021 at 22:22)</a>:</h4>
<p>if that happens, the rules and datafrog will still be invaluable as reference implementations whose behaviour we need to match</p>



<a name="221371925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/Endgame%20for%20Polonius%3F/near/221371925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/Endgame.20for.20Polonius.3F.html#221371925">(Jan 01 2021 at 22:23)</a>:</h4>
<p>sorry for the brain dump <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> I hope it was somewhat coherent, but that question probably needs <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>